package battleModel;

import java.awt.Point;
import java.io.Serializable;

public class TankOld implements Serializable{
	
	/**
	 * 
	 */ 
	private static final long serialVersionUID = 1L;
	
	@SuppressWarnings("unused")
	private String fileName, color, currLevel;
	private int highestLevel;
	private Point location;
	private double speed;
	private int[] levelScore;
	private boolean[] levelLocked;
	private double tankAngle, turretAngle;
	
	public TankOld(){
		location = new Point(300,300);
		speed = 3.0;
		tankAngle = 0;
		turretAngle = 0;
		fileName = "";
		color = "";
		
		levelLocked = new boolean[20];
		levelScore = new int[20];
		
		//1st level always unlocked!
		levelLocked[0] = true;
		levelScore[0] = 0;
		highestLevel = 1;
		
		//All other levels locked by default, 
		for(int i = 1; i < 20; i++){
			if(i < 11)
				levelLocked[i] = true;
			else
				levelLocked[i] = false;
			levelScore[i] = 0;
		}
	}
	
	/**
	 * Set the name of the player, will be the file name which 
	 * the player's profile is saved
	 * @param name Name of the Player
	 */
	public void setFileName(String name){
		fileName = name;
	}
	
	public String getName(){
		return fileName;
	}
	/**
	 * Sets the color of the players tank
	 * @param color - string value representing the color
	 */
	public void setColor(String color){
		this.color = color;
	}
	
	/**
	 * Get the player's tank speed
	 * @return speed of tank
	 */
	public double speed(){
		return speed;
	}
	
	/**
	 * Set the player's tank speed
	 * @param speed - new speed
	 */
	public void setSpeed(double speed){
		this.speed = speed;
	}
	
	/**
	 * Increase the speed of the player's tank with an increment
	 * @param inc
	 */
	public void increaseSpeed(double inc){
		speed += inc;
	}
	
	/**
	 * Set the current level chosen by the player
	 * @param level The level set to be played
	 */
	public void setLevel(String level){
		currLevel = level;
	}
	
	/**
	 * Check if level passed as argument is locked to the player
	 * @param level - level being checked if locked (1-20)
	 * @return true if locked, false if not locked
	 */
	public boolean checkLevelLocked(int level){
		return levelLocked[level-1];
	}
	
	/**
	 * Get player's score of the level specified
	 * @param level The level which to get the score from
	 * @return score of the level passed
	 */
	public int getLevelScore(int level){
		return levelScore[level - 1];
	}
	
	/**
	 * Set the player's score of the level passed
	 * @param level The level to set the score
	 * @param score The player's score of the level passed
	 */
	public void setLevelScore(int level, int score){
		levelScore[level - 1] = score;
	}
	
	public void levelPassed(){
		highestLevel++;
	}
	
	public int getHighestLevel(){
		return highestLevel;
	}
	/**
	 * Get the current level being played by the player
	 * @return Level number
	 */
	public int getCurrentLevel(){
		return Integer.valueOf(currLevel);
	}
	
	/**
	 * Adjust player Tank's angle
	 * @param adj - angle to be added to the current tank angle
	 * 				value can be negative or positive
	 */
	public void adjustTankAngle(double adj){
		tankAngle += adj;
	}
	
	/**
	 * Adjust player Turert's angle
	 * @param adj - angle to be added to the current turret angle
	 * 				value can be negative or positive
	 */
	public void adjustTurretAngle(double adj){
		turretAngle += adj;
	}
	
	/**
	 * Get the player's tank angle
	 * @return
	 */
	public double getTankAngle(){
		return tankAngle;
	}
	
	/**
	 * Get the player's turret angle
	 * @return
	 */
	public double getTurretAngle(){
		return turretAngle;
	}
	
	/**
	 * Get the location of the player on the map
	 * @return Location of the player
	 */
	public Point getLocation(){
		return location;
	}
}
